package com.example.demo.start;


public class StudyJavaStringClass {

    public static void main(String[] args) {

    }

    private static void  startString(){
        String str = "18682217335";
        String string = "1302664552";
        System.out.println(str.concat(string));// 拼接字符串

        System.out.println(str.charAt(1)); // 返回下标的值

        System.out.println(str.compareTo(string));

        System.out.println(str.contentEquals(string)); //当且仅当字符串与指定的String有相同顺序的字符时候返回真

        System.out.println(str.contentEquals(new StringBuffer(string)));// 当且仅当字符串与指定的StringBuffer有相同顺序的字符时候返回真

        char[] stringArrayList = str.toCharArray();
        for (char s: stringArrayList) {
            System.out.println(String.valueOf(s));
        }
    }
}
